# Maintainer: Zoltan Gyarmati <mr.zoltan.gyarmati@gmail.com>

_realname=trompeloeil
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=37
pkgrel=1
pkgdesc="Header only C++14 mocking framework (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url='https://github.com/rollbear/trompeloeil'
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-cmake")
license=('Boost')
source=(${_realname}-${pkgver}.tar.gz::https://github.com/rollbear/trompeloeil/archive/v${pkgver}.tar.gz)
sha256sums=('770555fa8f550b91f239fa4987fabf49c294eafc9bd73eb081d67d1d58ce51e8')

build() {
  rm -rf "${srcdir}/build-${MINGW_CHOST}"
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  
  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake.exe \
    -G"MSYS Makefiles" \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    "../trompeloeil-${pkgver}"

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR=${pkgdir} install
  
  install -Dm644 ${srcdir}/trompeloeil-${pkgver}/LICENSE_1_0.txt "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE_1_0.txt"
}
